package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "outbound_details", schema = "jinsanjiao", catalog = "")
public class OutboundDetails {
    private int outDetailsId;
    private Long outDetailsQuantity;
    private Inventory inventoryByInventoryNumber;
    private Outbound outboundByOutboundId;

    @Id
    @Column(name = "out_details_id", nullable = false)
    public int getOutDetailsId() {
        return outDetailsId;
    }

    public void setOutDetailsId(int outDetailsId) {
        this.outDetailsId = outDetailsId;
    }

    @Basic
    @Column(name = "out_details_quantity", nullable = true, precision = 0)
    public Long getOutDetailsQuantity() {
        return outDetailsQuantity;
    }

    public void setOutDetailsQuantity(Long outDetailsQuantity) {
        this.outDetailsQuantity = outDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OutboundDetails that = (OutboundDetails) o;
        return outDetailsId == that.outDetailsId &&
                Objects.equals(outDetailsQuantity, that.outDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(outDetailsId, outDetailsQuantity);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "outbound_id", referencedColumnName = "outbound_id")
    public Outbound getOutboundByOutboundId() {
        return outboundByOutboundId;
    }

    public void setOutboundByOutboundId(Outbound outboundByOutboundId) {
        this.outboundByOutboundId = outboundByOutboundId;
    }
}
